const BASE_URL = __DEV__ ? "http://localhost:3000" : "https://data.yiwupay.com";
import request from "./axios.js";
class CommonModel {
  constructor(baseURL, options = {}) {
    this.options = {
      ...options,
    };
  }
  post(options = {}) {
    return request({
      method: "post",
      ...this.options,
      ...options,
    });
  }
  // GATEWA_API  data:业务参数    needNonduplication:是否开启接口蒙层防重
  gatewayApi(data = {}) {
    let gatewayOpt = { ...data };
    // 请求参数 格式化
    gatewayOpt.bizContent = JSON.stringify({ ...data.bizContent });
    // 版本默认1.0.0
    return this.post({
      baseURL: BASE_URL,
      url: data.service,
      data: JSON.stringify(gatewayOpt),
      headers: {
        "Content-Type": "application/json",
      },
    });
  }
}

export default new CommonModel();
